package com.risen.project.enums;

import java.util.Arrays;
import java.util.Optional;

/**
 * 是否首次创建枚举
 */
public enum FirstCreateFlagEnum {

    FFE_FALSE("1", "否"),

    FFE_TRUE("2", "是"),
    ;

    private final String code;
    private final String msg;

    FirstCreateFlagEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsgByCode(String code) {
        Optional<FirstCreateFlagEnum> optional = Arrays.stream(values())
                .filter(c -> c.code.equals(code))
                .findFirst();

        return optional.isPresent() ? optional.get().msg : "";
    }
}
